package com.puyuba.puyuba.view.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseViewHolder;
import com.puyuba.puyuba.R;
import com.pyb.java.basemodule.BaseAdapter;
import com.puyuba.puyuba.bean.LevelInfoBean;

import java.util.List;

import androidx.annotation.Nullable;

public class FormAdatper extends BaseAdapter<LevelInfoBean> {
    private final Context context;

    public FormAdatper(Context context, @Nullable List data) {
        super(context, R.layout.item_recycleview_level, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, LevelInfoBean item) {

        helper.addOnClickListener(R.id.btn_recycleview_level);
        helper.setText(R.id.btn_recycleview_level,item.getName());

        boolean select = item.isSelect();
        if (select){
            helper.setBackgroundColor(R.id.btn_recycleview_level,context.getColor(R.color.color_fc6054));
            helper.setTextColor(R.id.btn_recycleview_level,context.getColor(R.color.white));
        }else {
            helper.setBackgroundColor(R.id.btn_recycleview_level,context.getColor(R.color.color_9B));
            helper.setTextColor(R.id.btn_recycleview_level,context.getColor(R.color.black));
        }
    }

}
